package com.business_clean.ui.adapter;

import android.widget.Button;
import android.widget.CheckBox;
import android.widget.TextView;

import androidx.core.content.ContextCompat;

import com.business_clean.R;
import com.business_clean.app.ext.CommonUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.List;

public class BaseChooseSingAdapter extends BaseQuickAdapter<String, BaseViewHolder> {

    private List isClick = new ArrayList<String>();

    public BaseChooseSingAdapter() {
        super(R.layout.item_choose_string);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder holder, String item) {
        CheckBox checkbox_dialog_choose = holder.getView(R.id.checkbox_dialog_choose);
        TextView chooseString = holder.getView(R.id.tv_dialog_choose);
        chooseString.setText(item);
        checkbox_dialog_choose.setChecked(isClick.contains(item));
    }


    /**
     * 更新状态
     *
     * @param data
     */
    public void updateItem(String data) {
        isClick.clear();
        isClick.add(data);
        notifyDataSetChanged();
    }

    public List getIsClick() {
        return isClick;
    }
}
